<template>
	<view>
		<scroll-view :scroll-y="modalName==null" class="page" :class="modalName!=null?'show':''">
			<cu-custom bgColor="bg-gradual-pink" :isBack="true">
				<block slot="backText">返回</block>
				<block slot="content">作业签发列表</block>
			</cu-custom>
			
			<uni-section :title="jobTicket.content" type="line" v-for="(jobTicket,index) in jobTicketList" :key="index">
				<uni-card padding="0" spacing="0">
					<view class="cu-item" >
						<form>
							<view class="cu-form-group">
								<view class="title">作业编号</view>
								<input name="input" v-model="jobTicket.number" disabled></input>
							</view>
							<view class="cu-form-group">
								<view class="title">申请人</view>
								<input name="input" v-model="jobTicket.applicant_dictText" disabled></input>
							</view>
							<view class="cu-form-group">
								<view class="title">活动时间</view>
								<input name="input" v-model="jobTicket.planStartDate" disabled/>
								至
								<input name="input" v-model="jobTicket.planEndDate" disabled/>
							</view>
						</form>
					</view>
					<view slot="actions" class="card-actions no-border">
						<view class="card-actions-item" @click="actionsClickEvent(jobTicket)">
							<text class="card-actions-item-text">作业活动</text>
						</view>
						<view class="card-actions-item" @click="actionsClickTicket(jobTicket)">
							<text class="card-actions-item-text">作业票</text>
						</view>
					</view>
				</uni-card>
			</uni-section>
		</scroll-view>
	</view>
</template>

<script>
	import api from '@/api/api.js'
	export default {
		name: "jobTicketIssuance",
		data() {
			return {
				modalName: null,
				jobTicketList: [],
			};
		},
		mounted() {
			this.initJobTicketList();
		},
		methods: {
			initJobTicketList(){
				api.queryJobTicketList({pageNo:1,pageSize:100,deleted:"0"}).then(response =>{
					if(response.data.success){
						this.jobTicketList = response.data.result.records
					}
				})
			},
			actionsClickEvent(record){
				//let parmas = {...record}
				console.log("=============="+JSON.stringify(record))
				this.$Router.push({name: 'jobTicketDetails',params:record})
				// uni.navigateTo({
				// 	url: 'jobTicketDetails?jobTicketDetail='+record
				// });
			}
		}
	}
</script>

<style>
	.page {
		height: 100Vh;
		width: 100vw;
	}

	.page.show {
		overflow: hidden;
	}

	.card-actions {
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		align-items: center;
		height: 45px;
		border-top: 1px #eee solid;
	}
	.card-actions-item {
		display: flex;
		flex-direction: row;
		align-items: center;
	}
	.card-actions-item-text {
		font-size: 12px;
		color: #666;
		margin-left: 5px;
	}
</style>
